﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace NodeBasedSkillEditor.View
{
    public partial class PortClusterGroupControl : UserControl
    {
        public const double SplitLineIndent = 0;

        private static SolidColorBrush _splitLineBrush;
        public static SolidColorBrush SplitLineBrush {
            get {
                if (_splitLineBrush == null)
                {
                    _splitLineBrush = new SolidColorBrush(Colors.Gray);
                    _splitLineBrush.Freeze();
                }
                return _splitLineBrush;
            }
        }

        private static Pen _splitLinePen;
        public static Pen SplitLinePen {
            get {
                if (_splitLinePen == null)
                {
                    _splitLinePen = new Pen(SplitLineBrush, 0.5);
                    _splitLinePen.Freeze();
                }
                return _splitLinePen;
            }
        }

        public string ClusterGroupName {
            get { return (string)GetValue(ClusterGroupNameProperty); }
            set { SetValue(ClusterGroupNameProperty, value); }
        }
        public static readonly DependencyProperty ClusterGroupNameProperty =
            DependencyProperty.Register("ClusterGroupName", typeof(string), typeof(PortClusterGroupControl),
                new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));


        public PortClusterGroupControl()
        {
            InitializeComponent();
        }

        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);
            drawingContext.DrawLine(
                SplitLinePen,
                new Point(SplitLineIndent, 0),
                new Point(ActualWidth - SplitLineIndent, 0));
        }

    }
}
